package com.ming.websocket.service.impl;

import com.ming.websocket.server.WebSocketServer;
import com.ming.websocket.service.TestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

@Service
@Slf4j
public class TestServiceImpl implements TestService {
    @Scheduled(fixedRate = 1000)// 毫秒
    public void printTime(){
        LocalDateTime now = LocalDateTime.now();
        WebSocketServer.sendInfo(now.toString(),"10");
        log.info("发送给 10:{}",now);
    }
}
